package com.qidian.mes.qc;/**
 * ClassName:test
 * Package:com.qidian.mes.qc
 **/

import com.alibaba.excel.EasyExcel;
import com.qidian.mes.desensitivity.DesensitivityUtilQc;
import com.qidian.mes.pojo.Flaw;
import com.qidian.mes.qc.service.FlawService;
import com.qidian.mes.util.dot.PagerDTO;
import com.qidian.mes.util.pojo.QdResult;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

/**
 * @Author ppc
 * @Conpany study
 * @Description:
 * @Time 2024/4/12 16:22
 *
 **/
@SpringBootTest
public class test {
    @Autowired
    private com.qidian.mes.qc.service.FlawService FlawService;
    @Test
    public void testEasyExcel() {
        //查询用户列表
        QdResult<PagerDTO<Flaw>> qdResult = FlawService.queryByPage(null,1,10);
        List<Flaw> flaws = qdResult.getData().getData();

        //进行脱敏处理
        flaws.forEach(flaw -> {
                    DesensitivityUtilQc.desensitization(flaw);
        });
        //通过EasyExcel写数据
        String targetFile = "D:\\test4.xlsx";
        EasyExcel.write(targetFile,Flaw.class).sheet("缺陷信息").doWrite(flaws);
    }
}
